package com.trg.designmodel.commond;

/**
 * @author trg
 * @title: Client
 * @projectName designmodel
 * @description: TODO
 * @date 2022/3/2123:11
 */
public class Client {

    public static void main(String[] args) {
        LightReceiver lightReceiver = new LightReceiver();
        LightOnCommond lightOnCommond = new LightOnCommond(lightReceiver);
        LightOffCommond lightOffCommond = new LightOffCommond(lightReceiver);

        RemoteController remoteController = new RemoteController();
        //先设置遥控器
        remoteController.setCommand(1,lightOnCommond,lightOffCommond);
        //然后再使用遥控器
        System.out.println("==============================打开灯光");
        remoteController.turnOnButton(1);
        System.out.println("==============================关闭灯光");
        remoteController.turnOffButton(1);
        System.out.println("==============================撤销");
        remoteController.undoButtonWasPushed();



    }
}
